package com.framework.component.extension.context;

import lombok.Builder;
import lombok.Getter;
import lombok.extern.jackson.Jacksonized;

@Getter
@Builder
@Jacksonized
public class BizScenario {
    public static final String DEFAULT_BIZ_ID = "#defaultBizId#";
    public static final String DEFAULT_USE_CASE = "#defaultUseCase#";
    public static final String DEFAULT_SCENARIO = "#defaultScenario#";
    public static final String SPLIT_CHAR = ".";

    /**
     * 业务 id
     */
    private String bizId = DEFAULT_BIZ_ID;

    /**
     * 用例
     */
    private String useCase = DEFAULT_USE_CASE;

    /**
     * 业务场景
     */
    private String scenario = DEFAULT_SCENARIO;

    public static BizScenario valueOf(String bizId, String useCase, String scenario) {
        return BizScenario.builder().bizId(bizId).useCase(useCase).scenario(scenario).build();
    }

    public String getUniqueKey() {
        return this.bizId + SPLIT_CHAR + this.useCase + SPLIT_CHAR + this.scenario;
    }
}
